import logging
import traceback

logging.basicConfig(
    level=logging.ERROR,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',  # 设置日志格式
    filename='../../error.log',
    filemode='a'
)
logger = logging.getLogger(__name__)


def log_e(e,print_trace=True):
    if print_trace:
        traceback.print_exc()
    logger.error(str(e))